package com.xuxin.pda.listener;

import android.zyapi.pos.interfaces.OnPrintEventListener;

import com.blankj.utilcode.util.ToastUtils;

/**
 * Created by xu_xin
 * Created on 2020/12/24 0024
 */
public class PrinterListener implements OnPrintEventListener {
    @Override
    public void onEvent(int event) {
        switch (event) {
            case EVENT_UNKNOW:
                ToastUtils.showShort("未知错误");
                break;
            case EVENT_NO_PAPER:
                ToastUtils.showShort("打印机缺纸");
                break;
            case EVENT_PAPER_JAM:
                ToastUtils.showShort("打印机卡纸");
                break;
            case EVENT_PRINT_OK:
                ToastUtils.showShort("打印完成");
                break;
            case EVENT_HIGH_TEMP:
                ToastUtils.showShort("机芯温度过热");
                break;
            case EVENT_LOW_TEMP:
                ToastUtils.showShort("机芯温度过低");
                break;
            case EVENT_CONNECTED:
                ToastUtils.showShort("打印机连接完成");
                break;
            case EVENT_CONNECT_FAILD:
                ToastUtils.showShort("打印机连接失败");
                break;
            case EVENT_STATE_OK:
                ToastUtils.showShort("打印机状态正常");
                break;
            case EVENT_CHECKED_BLACKFLAG:
                ToastUtils.showShort("检测到黑标");
                break;
            case EVENT_NO_CHECKED_BLACKFLAG:
                ToastUtils.showShort("未检测到黑标");
                break;
            case EVENT_TIMEOUT:
                ToastUtils.showShort("打印机响应超时");
                break;
            case EVENT_PRINT_FAILD:
                ToastUtils.showShort("打印失败");
                break;
            default:
                ToastUtils.showShort("打印失败:" + event);
                break;
        }
    }

    @Override
    public void onGetState(int cmd, int state) {

    }

    @Override
    public void onCheckBlack(int event) {
        switch (event) {
            case EVENT_CHECKED_BLACKFLAG:
                ToastUtils.showShort("检测到黑标");
                break;
            case EVENT_NO_CHECKED_BLACKFLAG:
                ToastUtils.showShort("没有检测到黑标");
                break;
            case EVENT_NO_PAPER:
                ToastUtils.showShort("检测黑标时缺纸");
                break;
        }

    }
}